//
// Created by Administrator on 2024/7/30.
//

#ifndef JTT809_0X1201_H
#define JTT809_0X1201_H
#include "jtt809_sub_body.h"
#include "../../jtt809_body.h"
#include "../../util/types.h"

namespace protocol {

class JTT809_0x1201 final : public JTT809SubBody { public:
    uint8_t platformId[11]{};
    uint8_t producerId[11]{};
    uint8_t terminalModelType[30]{};
    char imeiId[15]{};
    uint8_t terminalId[30]{};
    char terminalSimCode[13]{};

    IMPLEMENT_SIZEABLE(platformId, producerId, terminalModelType, imeiId, terminalId, terminalSimCode)

public:
    JTT809_0x1201() : JTT809SubBody(0x1201) {}

    JTT809_0x1201(const Bytes<11> &platform_id, const Bytes<11> &producer_id, const Bytes<30> &terminal_model_type,
        const char imei_id[15], Bytes<30> terminal_id, const char terminal_sim_code[13]) : JTT809SubBody(0x1201) {
        std::copy_n(platform_id.bytes, sizeof(platformId), platformId);
        std::copy_n(producer_id.bytes, sizeof(producerId), producerId);
        std::copy_n(terminal_model_type.bytes, sizeof(terminalModelType), terminalModelType);
        std::copy_n(imei_id, sizeof(imeiId), imeiId);
        std::copy_n(terminal_id.bytes, sizeof(terminalId), terminalId);
        std::copy_n(terminal_sim_code, sizeof(terminalSimCode),terminalSimCode);
    }

    JTT809_0x1201(const JTT809_0x1201 &other) = default;

    JTT809_0x1201 & operator=(const JTT809_0x1201 &other) = default;

    ~JTT809_0x1201() override = default;

    void serialize(MessagePackWriter &writer) override;

    void deserialize(MessagePackReader &reader) override;

    [[nodiscard]] std::string toString() const override;
};

} // jtt809

#endif //JTT809_0X1201_H
